package com.my.study.springframework.context.support;

import com.my.study.springframework.bean.factory.support.DefaultListableBeanFactory;
import com.my.study.springframework.bean.factory.xml.XmlBeanDefinitionReader;

/**
 * @author: yidujun
 * @create: 2021/06/24 17:17
 */
public abstract class AbstractXmlApplicationContext extends AbstractRefreshableApplicationContext {

    @Override
    protected void loadBeanDefinitions(DefaultListableBeanFactory beanFactory) {
        XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(beanFactory, this);
        String[] locations = getConfigLocations();
        reader.loadBeanDefinitions(locations);
    }

    /**
     * 获取资源路径
     * @return
     */
    protected abstract String[] getConfigLocations();
}
